library(SDMTools)

work.dir = "E:/Barra Work Directory/bioclim wet tropics/"; setwd(work.dir)

bc01 = read.asc.gz('E:/Barra Work Directory/bioclim wet tropics/bc01.asc.gz')

#create the images
#indicate the position of the legend in lats and longs
pnts=cbind(x=c(115,118,118,115), y=c(-10,-10,-15,-15))
cols = colorRampPalette(c('skyblue','slateblue','forestgreen','yellow','red'))(101)
png(paste('bc01.png',sep=''), width=7, height=7, units='cm', res=300, pointsize=5, bg='white')
	image(bc01,ann=FALSE,axes=FALSE,col=cols)
  legend.gradient(pnts,cols=cols,limits=range(bc01, na.rm=T)/10, title='Annual Mean Temp')
dev.off()

